# 提示输入域名，然后脚本去查询，并且返回结果    https://whois.chinaz.com/www.jd.com

#! /usr/bin/python3

import requests
import bs4

def get_whoisInfo():
	while 1:
		domain = input("请输入要whois查询的域名(输入Bye可退出)：")
		if domain == "Bye":
			break

		url = f"https://whois.chinaz.com/{domain}"
		headers = {"User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36"}

		response = requests.get(url=url,headers=headers)
		html = response.text

		result = bs4.BeautifulSoup(html,"html.parser")
		data1 = result.find("div",class_="group-has-[.unregistered]:hidden")

		print("=======whios infomation========")
		print(data1.text.strip().split())
		print("===================")

if __name__ == '__main__':
	get_whoisInfo()

